addpath(pwd);  %adds the snake 
addpath('..\filter');  %adds the filter code

switch('nothing')

case 'generate_circle_test_points_octave'
%you may want to regenerate this data if you are running Octave because
%it lacks the roipoly function to choose points
    cp=[33 40 64 72 70 31 27 33].';
    rp=[32 28 29 44 71 72 53 32].';
    
    filename='circletest.png'
    save(strcat(filename,'_cp.txt'),'cp','-ascii');    
    save(strcat(filename,'_rp.txt'),'rp','-ascii');
    getNewRoi=false;  %if you are running in Octave this must be false because Octave does
    %not include roipoly
case 'nothing'
%This will run the demo as is

otherwise
    error('Invalid option')
end
    


filename='circletest.png';  %the file to run the snake on.
getNewRoi=false;  %if you are running in Octave this must be false because Octave does
 %not include roipoly

[rpFinal, cpFinal]=calcSnake(filename,false);

figure
imshow(img)
hold on;
plot(cp,rp,'r');
plot(cp,rp,'bx');
hold off;
title('Original snake points')

figure
imshow(img)
hold on;
plot(cpFinal,rpFinal,'r');
plot(cpFinal,rpFinal,'bx');
hold off;
title('Final snake points')

%set to 1 if you want to show the steps in the processing
if 0
    img = imread(filename);
    img=im2double(img);

    sigma=4
    [H]=createGaussianFilter([sigma sigma],[11 11]);
    smoothedImg=filterSeperable(H,img);

    gradMag = calcGradientMag(smoothedImg);

    figure;
    imshow(img);
    title('Original Image')

    figure;
    imshow(smoothedImg);
    title('Smoothed Image')

    figure;
    imshow(gradMag);
    title('Magnitude of Image Gradient')
end